package cn.cxq.learning.sparse_array;

public class Client {
    public static void main(String[] args) {

        int[][] arr = new int[12][12];
        arr[1][2] = 12;
        arr[11][10] = 130;
        arr[2][4] = 22;

        print(arr);
        System.out.println();

        int[][] sparseArray = SparseArray.convertIntoSparseArray(arr);

        print(sparseArray);
        System.out.println();

        int[][] arr2 = SparseArray.convertIntoArray(sparseArray);

        print(arr2);
    }

    private static void print(int[][] arr){
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j]+"\t");
            }
            System.out.println();
        }
    }
}
